//统一配置
$.ajaxPrefilter(function (option) {
  //统一配置路径
  option.url = "http://www.itcbc.com:8080" + option.url;
  //统一配置携带请求头
  option.headers = {
    Authorization: localStorage.getItem("token"),
  };
  //二次判断token值,如果token值不对,则删除虚假值,跳出index
  option.complete = function (val) {
    let res = val.responseJSON;
    //判断token值真假
    if (res && res.status === 1 && res.message === "身份认证失败") {
      // 清除假token
      localStorage.removeItem("token");
      //跳转到登录界面
      parent.location.href = "../login.html";
    }
  };
});
